Conversation
| Set-MyInvokeCommandAlias -Alias GetNow -Command "Get-Date -Format 'yyyy-MM-dd'" | ||
| Set-MyInvokeCommandAlias -Alias GetUtcNow -Command "Get-Date -AsUTC" | ||
|
|
||
| function Get-DaysBetweenDates { |
Check warning
Code scanning / PSScriptAnalyzer
The cmdlet 'Get-DaysBetweenDates' uses a plural noun. A singular noun should be used instead. Warning
| $futureDate = (Get-Date).AddDays(10) | Get-Date -Format 'yyyy-MM-dd' | ||
|
|
||
| $result = Get-DaysBetweenDates -EndDate $futureDate | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| $dateTime = [datetime]::UnixEpoch.AddDays(-1) | ||
|
|
||
| $result = ConvertTo-EpochTime -DateTime $dateTime | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| $start = [DateTime]::ParseExact($StartDate, 'yyyy-MM-dd', $null) | ||
| $end = [DateTime]::ParseExact($EndDate, 'yyyy-MM-dd', $null) | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| $end = [DateTime]::ParseExact($EndDate, 'yyyy-MM-dd', $null) | ||
|
|
||
| $timeSpan = $end - $start | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| $epoch = [datetime]::UnixEpoch | ||
| $now = Invoke-MyCommand -Command GetUtcNow | ||
| $timeSpan = $now - $epoch | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| [Parameter(Mandatory, Position = 0)] | ||
| [long]$EpochTime | ||
| ) | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| $epoch = [datetime]::UnixEpoch | ||
| $dateTime = $epoch.AddSeconds($EpochTime) | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
| [Parameter(Mandatory, Position = 0)] | ||
| [datetime]$DateTime | ||
| ) | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| $epoch = [datetime]::UnixEpoch | ||
| $timeSpan = $DateTime.ToUniversalTime() - $epoch | ||
|
|
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
… and improve caching logic
| Export-ModuleMember -Function $NewName | ||
|
|
||
| function Add-MyModuleConfigAttribute{ | ||
| function Set-ModuleNameConfigValue{ |
Check warning
Code scanning / PSScriptAnalyzer
Function 'Set-ModuleNameConfigValue' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. Warning
| return $false | ||
| } | ||
| finally{ | ||
| Remove-Variable -Scope Script -Name "config-$Key" -ErrorAction SilentlyContinue |
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
Include library with functions that help on the management of dates